import { http, type ResultBoolean, type ResultList } from "@/utils/http";

// 获取Banner分页列表
export const getBannerListPages = (data?: object) => {
  return http.request<ResultBoolean>("post", `/api/banner/page`, { data });
};

// 查询所有Banner（可带条件）
export const getBannerList = (data?: object) => {
  return http.request<ResultList>("post", `/api/banner/list`, { data });
};

// 创建Banner
export const createBanner = (data: BannerVO) => {
  return http.request<ResultBoolean>("post", `/api/banner/add`, { data });
};

// 更新Banner
export const updateBanner = (data: BannerVO) => {
  return http.request<ResultBoolean>("post", `/api/banner/edit`, { data });
};

// 删除Banner
export const deleteBanner = (id: number) => {
  return http.request<ResultBoolean>("post", `/api/banner/delete/${id}`);
};

// 根据ID获取Banner详情
export const getBannerDetail = (id: number) => {
  return http.request<ResultBoolean>("get", `/api/banner/detail/${id}`);
};

/**
 * Banner VO接口定义
 */
export interface BannerVO {
  id?: number;
  imageUrl?: string;
  linkUrl?: string;
  title?: string;
  displayOrder?: number;
  isActive?: boolean;
  createdAt?: string;
  updatedAt?: string;
  [property: string]: any;
}
